package entity;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.PrimaryKeyJoinColumn;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;

@Entity
@PrimaryKeyJoinColumn(name = "id")
public class BSC_Perspective extends BSCElement{
	
	@Column(insertable=false, updatable=false)
	private int id;
	
	@ManyToOne(fetch = FetchType.LAZY)
	private StrategicPlan strategicPlan;
	
	@ManyToOne(fetch = FetchType.LAZY)
	private StrategicPerspective strategicPerspective;
	
	@OneToMany(mappedBy="perspective", fetch = FetchType.LAZY)
	@Cascade({CascadeType.ALL, CascadeType.DELETE_ORPHAN})
	private List<BSCGoal> listBSCGoal;
	
	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name="SWOTElement_Perspective", joinColumns=@JoinColumn(name="Perspective_id"), inverseJoinColumns=@JoinColumn(name="SWOTElement_id"))
	private List<SWOTElement> swotElements;	
	
	private Integer position;
	
	public void setId(int id) {
		this.id = id;
	}

	public int getId() {
		return id;
	}

	public void setStrategicPlan(StrategicPlan strategicPlan) {
		this.strategicPlan = strategicPlan;
	}

	public StrategicPlan getStrategicPlan() {
		return strategicPlan;
	}

	public void setStrategicPerspective(StrategicPerspective strategicPerspective) {
		this.strategicPerspective = strategicPerspective;
	}

	public StrategicPerspective getStrategicPerspective() {
		return strategicPerspective;
	}

	public void setListBSCGoal(List<BSCGoal> listBSCGoal) {
		this.listBSCGoal = listBSCGoal;
	}

	public List<BSCGoal> getListBSCGoal() {
		return listBSCGoal;
	}

	public void setPosition(Integer position) {
		this.position = position;
	}

	public Integer getPosition() {
		return position;
	}

	public void setSwotElements(List<SWOTElement> swotElements) {
		this.swotElements = swotElements;
	}

	public List<SWOTElement> getSwotElements() {
		return swotElements;
	}
}
